package top.yxqz.springmvc.annotation.config;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import org.springframework.web.servlet.support.AbstractDispatcherServletInitializer;

/**
 * @author: 余小小
 * @date: 2023/5/23
 * @description： web.xml
 * 1.创建web.xml的替代配置类：继承AbstractAnnotationConfigDispatcherServletInitializer类-----WebApplicationInitializer
 * 2.创建spring、springmvc的替代配置类
 */
public class WebInit extends AbstractAnnotationConfigDispatcherServletInitializer {

    /**
     * 配置spring的配置文件的
     *
     * @return
     */

    @Override
    protected Class<?>[] getRootConfigClasses() {
//        Class[] classes = new Class[]{SpringConfig.class};
        return new Class[]{SpringConfig.class};
    }

    /**
     * 配置springmvc的配置文件的
     *
     * @return
     */
    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{SpringmvcConfig.class};
    }

    /**
     * 配置映射
     *
     * @return
     */
    @Override
    protected String[] getServletMappings() {
        return new String[]{"/"};
    }
}
